package app.dao.test;

import vn.bang.xiangqi.server.ServerManager;
import vn.bang.xiangqi.server.thread.CommandProcessorThread;

import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;

public class ControllerPage extends Panel {

	private static final long serialVersionUID = 1L;

	private ServerControllerPanel pnlLoginServer = new ServerControllerPanel("LOGIN SERVER");
	private ServerControllerPanel pnlXiangqiServer = new ServerControllerPanel("XIANGQI SERVER");
	
	public ControllerPage() {
		ServerManager serverManager = new ServerManager();
		pnlLoginServer.setServer(serverManager.getLoginServer());
		pnlXiangqiServer.setServer(serverManager.getXiangqiServer());
		CommandProcessorThread commandProcessorThread = serverManager.getCommandProcessorThread();
		commandProcessorThread.start();
		
		VerticalLayout verticalLayout = new VerticalLayout();
		verticalLayout.addComponent(pnlLoginServer);
		verticalLayout.addComponent(pnlXiangqiServer);
		verticalLayout.setSpacing(Boolean.TRUE);
		setContent(verticalLayout);
	}
	
}
